<template>
    <view class="wrap">
        <view class="pay_money">
            <view class="money_title">支付金额</view>
            <view class="money_num">￥{{ totalmem }}</view>
        </view>
        <view class="pay_way">
            <view class="contner">
                <view class="pay_wrap" @click="change_type('wxpay')">
                    <image src="../../static/images/money/weixin.png" mode="scaleToFill" />
                    <view class="weixn_title"><text class="title">微信支付</text><text class="recommend">推荐使用微信支付</text></view>
                    <u-icon name="checkmark-circle-fill" :color="pay_type == 'wxpay' ? '#fdd100' : '#d1d1d1'"
                        size="28"></u-icon>
                </view>
                <view class="pay_wrap" @click="change_type('alipay')">
                    <image src="../../static/images/money/zhifubao.png" mode="scaleToFill" />
                    <view class="weixn_title"><text class="title">支付宝支付</text></view>
                    <u-icon name="checkmark-circle-fill" :color="pay_type == 'alipay' ? '#fdd100' : '#d1d1d1'"
                        size="28"></u-icon>
                </view>
            </view>
        </view>
        <view class="confirm_payment" @click="confirm">确认支付</view>
    </view>
</template>

<script>
import { get_order_payOrder } from '../../api/order'
export default {
    data() {
        return {
            orderId: '',
            totalmem: '',
            pay_type: 'wxpay'
        }
    },
    onLoad(options) {
        console.log(options)
        this.totalmem = options.totalmem,
            this.orderId = options.orderId
    },
    methods: {
        change_type(type) {
            console.log(type)
            this.pay_type = type
        },
        confirm() {
            get_order_payOrder({
                pay_type: 'alipay',
                orderId: this.orderId
            }, { token: uni.getStorageSync('token'), platform: 'app-plus' }).then(res => {
                console.log(res)
            })
        }

    },

}
</script>

<style lang="scss" scoped>
.wrap {
    width: 100%;

    .pay_money {
        width: 100%;
        height: 200px;
        background-color: #fff;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

        .money_title {
            font-size: 18px;
            color: #ac9f9f;
        }

        .money_num {
            margin-top: 5px;
            font-size: 20px;
            color: #fdd100;
        }
    }


    .pay_way {
        width: 100%;
        background-color: #fff;
        margin-top: 20px;

        .contner {
            width: 90%;
            margin: 0 auto;

            .pay_wrap {
                width: 100%;
                height: 60px;
                display: flex;
                justify-content: space-between;
                align-items: center;
                border-bottom: 1px solid rgb(241, 237, 237);

                .weixn_title {
                    width: 70%;
                    display: flex;
                    flex-direction: column;
                    align-items: flex-start;
                }

                image {
                    width: 25px;
                    height: 25px;
                }
            }
        }

    }

    .confirm_payment {
        width: 90%;
        height: 50px;
        text-align: center;
        line-height: 50px;
        color: #fff;
        margin: 20px auto;
        background-color: #fdd100;
        border-radius: 10px;
    }

}
</style>